/*
 * Copyright (c) 2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. 
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. 
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. 
 * Vestibulum commodo. Ut rhoncus gravida arcu. 
 */

import java.math.BigDecimal;

public class Demo01 {

    public static String strxx;

    public static void main(String[] args) {
        System.out.println(0.1d == 0.1f); // false
        System.out.println(0.125d == 0.125f); //true
        System.out.println(new BigDecimal(0.1d));
        System.out.println(new BigDecimal(0.1f));

        System.out.println(new BigDecimal(0.125d));
        System.out.println(new BigDecimal(0.125f));

        char a = 'a';
        System.out.println(a);
        char b = 66;
        System.out.println(b);
        char c = 20013;
        System.out.println(c);
        int d = '中';
        System.out.println(d);
        boolean e = true;
        System.out.println(e);


        int a1 = 1;
        long a2 = a1;//隐式转换
        a1 = (int) a2;// 显式转换
        System.out.println(a1);
        a2 = Integer.MAX_VALUE+3;
        a1 = (int) a2;// 显式转换 //超出类型会发生溢出
        System.out.println(a1);
        a2 = Integer.MAX_VALUE+1;
        a1 = (int) a2;// 显式转换 //超出类型会发生溢出
        System.out.println(a1);
        a1 = 1;
        float a3 = a1;
        a3 = a2;//表示数值的范围大小,而不是占用位数的多少
        char a4 = (char)a1;

//        boolean a5 = (boolean)a1;
//        boolean a6 = (boolean)a4;
        boolean a7 = true;
        a1 = 123;
//        a2 = 9999999999;//编译错误
        byte a8 = 127;
//        a8 = 128;//编译错误

        a4 = 'A';
        a4 = 67;
        a4 = 0;
//        a4 = -1;//char类型不允许负值

        float f1 = 0.1f;
        double d1 = 0.1d;
        d1 = 0.1;
//        f1 = 0.1;//编译错误
        f1 = (float)0.1;

        //十进制
        a1 = 1;
        //二进制 0,1
        a1 = 0b11;//3
        //八进制 0-7
        a1 = 071;
        //十六进制 [0-9a-f] 0x1 0xFF=255 0x11=17
        a1 = 0Xff;

        d1 = 1.1;
//        d1 = 0b1.1;

        //引用类型
        Object obj = new Object();
        String str = "asdfsdfasdf";
        str = new String("asdfadsf");

        int i1,i2;
        i1 = 1;
        i2 = 1;
        System.out.println(i1 == i2);
        String s1,s2;
        s1 = new String("aa");
        s2 = new String("aa");
        String s3 = s1;
        System.out.println(s1 == s2);
        System.out.println(s1 == s3);
        s1 = "aa";
        s2 = "aa";
        System.out.println(s1 == s2);

//        String s4;//局部变量必须先赋值才能使用
//        System.out.println(s4);
        System.out.println(strxx);
    }
}
